using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BombControl : MonoBehaviour
{
    public GameObject EffectPre;
    // Start is called before the first frame update
    void Start()
    {
        Invoke("Boom", 2f);
    }
    void Boom()
    {
        GameObject effect = Instantiate(EffectPre, transform.position, transform.rotation);
        Destroy(effect, 2f);
        GameObject[] enemys = GameObject.FindGameObjectsWithTag("Enemy");
        foreach (GameObject enemy in enemys)
        {
            if (Vector3.Distance(transform.position, enemy.transform.position) < 3f)
            {
                Destroy(enemy);
            }
            Destroy(gameObject);
        }
    }
}
